﻿using TencentCloud.Iai.V20200303;
using TencentCloud.Iai.V20200303.Models;

namespace FaceRecognizer
{
    public class Person
    {
        public string  GroupId {  set; get; }

        public string  Name {  set; get; }

        public string Id { set; get; }

        public string Image { set; get; }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="groupid"></param>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="image"></param>
        //public Person(string groupid, string id,string name, string image)
        //{
        //    GroupId = groupid;
        //    Id = id;
        //    Image=image;
        //    Name= name;
        //}
        
        /// <summary>
        /// 添加人员库中的人员信息
        /// </summary>
        /// <param name="client"></param>
        /// <param name="groupid"></param>
        /// <param name="id"></param>
        /// <param name="gender"></param>
        /// <param name="name"></param>
        /// <param name="image"></param>
        /// <returns></returns>
        public CreatePersonResponse Create(IaiClient client, string personname, string groupid, string id, string image)
        {
            CreatePersonRequest createPersonRequest = new CreatePersonRequest();
            createPersonRequest.GroupId = groupid;
            createPersonRequest.PersonId = id;
            createPersonRequest.Image = image;
            createPersonRequest.PersonName = personname;
            // 返回的resp是一个CreatePersonResponse的实例，与请求对象对应
            return client.CreatePersonSync(createPersonRequest);
        }
       
        /// <summary>
        /// 删除人员库中的人员信息
        /// </summary>
        /// <param name="client"></param>
        /// <param name="groupid"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public DeletePersonFromGroupResponse Delete(IaiClient client, string groupid, string id)
        {
            DeletePersonFromGroupRequest deletepersonFromgroup = new DeletePersonFromGroupRequest();
            deletepersonFromgroup.PersonId = id;
            deletepersonFromgroup.GroupId = groupid;
            // 返回的resp是一个DeletePersonFromGroupResponse的实例，与请求对象对应
            return client.DeletePersonFromGroupSync(deletepersonFromgroup);
        }
    }
}
